<?php

require dirname(__FILE__). "/../classes/ContactPark.class.php";
require dirname(__FILE__). "/../classes/ParkDAO.class.php";
require dirname(__FILE__). "/../classes/ConnectionFactory.class.php";
require dirname(__FILE__). "/checksDate.action.php";

$park=new ContactPark();
$checksate= new checksDate();

if(isset($_GET['id']) && (!empty($_GET['id']))) {
$con=new ConnectionFactory();
$co=$con->getConnection();

$dao=new ParkDAO($co);

$park=$dao->getById($_GET['id']);

$datein=$park->getDatein();

$dateout=$checksate->dataAtual();
$tarifa=$park->getFare();
$horas=$checksate->DiferencaData($datein,$dateout);

$park->setHours($horas);
$park->setDatein($checksate->convertsDatehora($datein));
$park->setDateout($checksate->convertsDatehora($dateout));

$total=$horas*$tarifa;

$park->setTotal($total);

}

?>
